]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Remove source icon when a corresponding window is activated
authorFlorian Müllner <fmuellner@src.gnome.org>
Sun, 21 Feb 2010 05:25:23 +0000 (06:25 +0100)
committerFlorian Müllner <fmuellner@src.gnome.org>
Tue, 23 Feb 2010 18:03:20 +0000 (19:03 +0100)
Source icons are no longer needed to inform the user about events
having occured in a particular application when (s)he activates the
window - treat that case just as if the user had clicked the source
icon.

https://bugzilla.gnome.org/show_bug.cgi?id=610494

js/ui/messageTray.js
js/ui/notificationDaemon.js

index 2907f920d3f30e9201c5343a7a300243303a1e95..fe7a081661fedb7388f06c4fe306a9734944a847 100644 (file)
@@ -489,6 +489,12 @@ MessageTray.prototype = {
         }
     },
 
+    removeSourceByApp: function(app) {
+        for (let source in this._sources)
+            if (this._sources[source].app == app)
+                this.removeSource(this._sources[source]);
+    },
+
     removeNotification: function(notification) {
         if (this._notification == notification && (this._notificationState == State.SHOWN || this._notificationState == State.SHOWING)) {
             if (this._notificationTimeoutId) {
index 7f5dfcf7e32b99967db366044c700c367097a1b2..89710d62bd77872f9b48ff6f6df30d16d58ee19d 100644 (file)
@@ -100,6 +100,9 @@ NotificationDaemon.prototype = {
                                   Lang.bind(this, this._lostName));
 
         this._currentNotifications = {};
+
+        Shell.WindowTracker.get_default().connect('notify::focus-app',
+            Lang.bind(this, this._onFocusAppChanged));
     },
 
     _acquiredName: function() {
@@ -260,6 +263,10 @@ NotificationDaemon.prototype = {
         ];
     },
 
+    _onFocusAppChanged: function(tracker) {
+        Main.messageTray.removeSourceByApp(tracker.focus_app);
+    },
+
     _actionInvoked: function(notification, action, source, id) {
         this._emitActionInvoked(id, action);
         source.destroy();